package com.liulihui.web.controller;

import com.liulihui.domain.User;

import com.liulihui.service.UserService;
import com.liulihui.web.vo.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * @ClassName: UserController
 * @Description:
 * @Author liulihui
 * @Date: 2021/8/4 11:40
 * @URL：
 * @Version 1.0
 */
@Controller
public class UserController {

    private Logger logger=LoggerFactory.getLogger(UserController.class);
    @Autowired   //注入service对象
    private UserService userService;
    @PostMapping("/user")   //resetful风格编码
    @ResponseBody
    public Result add(@RequestBody User user){
       logger.info("注册用户信息");  //打印信息
        userService.register(user);

        return Result.success(); //返回注册成功消息
    }

}